/*********************************************************************
* File:: TournamentCounterTerroristAgent.h
* \brief The terrorist BDI with Communication agent.
*********************************************************************/
#pragma once
#pragma warning (disable: 4482) // Ignore non-standard extension warnings

#include "CounterTerroristAgent.h"

//Debugging includes
#include "../util/debug.h"


namespace agents{ 
	/**
	* \class TournamentCounterTerroristAgent
	* \brief The terrorist BDI with Communication agent.
	*
	* \author Instituto Superior Tecnico de Lisboa, Portugal
	* \author Technical University of Lisbon, Portugal
	* 
	* \author David Simao
	* \author Jorge Pereira
	* \author Filipa Ramos
	* 
	* \version	1.0
	* \date		2008
	**/
	class TournamentCounterTerroristAgent: public CounterTerroristAgent{
	public:
		TournamentCounterTerroristAgent(edict_t *enity, int model);
		~TournamentCounterTerroristAgent();

		void newRound();

	private:

		//Beliefs
		enum Beliefs { SEE_ENEMIES, SEE_FRIENDS, HAS_GRENADE, AT_GOAL_POINT, HAS_AMMO, 
					   HEAR_BOMB, CAN_BUY, IS_INJURED, SEE_BOMBER, SEE_BOMB, IS_STUCK, BOMB_SPOTTED, ENEMY_SPOTTED };

		int beliefs[14];

		bool geared_up;
		bool _NeedToExplore;
		bool _runAway;
		bool _RunningToEnemy;
		int enemyCount;
		IVision::IVisibleAgent** enemies;
		Vector hearDirection;
		Vector enemyPosition;
		Vector bombPosition;

		int bombWaypoint;
		int enemyWaypoint;

		//Desires
		enum Desires { KILL_ENEMY, PROTECT_BOMB, WELL_EQUIPPED, UNSTUCK, GET_AMMO,
						STAY_ALIVE, SCOUT_AREA, FIND_HIM, DEFUSE_BOMB, GO_DEFUSE_BOMB, GO_FIGHT_ENEMY };

		int desires[11];


		//Intentions
		enum Intentions { GO_BUY, LOOK_ARROUND, KILL, RELOAD, GET_UNSTUCK, EXPLORE_AREA, HUNT, DEFUSE, GO_TO_BOMB,
							GO_BOMB_SPOT, GO_ENEMY_SPOT };
		
		int intentions[13];



		//Plan Array
		std::list<Intentions> currentPlan;

		//BDI functions
		void BDIreset();
		void update_beliefs();
		void options();
		void filter_desires();
		void create_plan();
		bool reconsider();
		bool execute(int intention);
		void think();
	};
}